package com.arouter;

import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.VideoView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.cjt2325.cameraview.R;

@Route(path = "/test/activity1")
public class ARouterActivity1 extends AppCompatActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_arouter1);

        //重点加上这个
        ARouter.getInstance().inject(this);

        final VideoView videoView = (VideoView) findViewById(R.id.videoView);

//        videoView.setVideoPath("http://47.106.120.137:8280/www/mp4/9CEE1F543AC177E7FD3CFD80A40D09BC.mp4");
        videoView.setVideoURI(Uri.parse("http://47.106.120.137:8280/www/mp4/9CEE1F543AC177E7FD3CFD80A40D09BC.mp4"));

        videoView.start();

        videoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
            @Override
            public void onCompletion(MediaPlayer mp) {
                videoView.seekTo(0);
                videoView.start();
            }
        });
    }
}
